package Utils;


import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author admin
 * @Date 2019/2/25 10:33
 */
public class C3P0Utils {
   private static DataSource dataSource=null;
   static {
ComboPooledDataSource ds = new ComboPooledDataSource("zjitc");
dataSource = ds;
   }
   public static Connection getConnection(){
       try {
           return dataSource.getConnection();
       } catch (SQLException e) {
           e.printStackTrace();
       }
       return null;
   }

    public static DataSource getDataSource() {
        return dataSource;
    }
}
